package cn.itsource.hrm.client;

import cn.itsource.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class RedisClientFallbackFactory implements FallbackFactory<RedisClient> {
    @Override
    public RedisClient create(Throwable throwable) {
        return new RedisClient() {
            @Override
            public AjaxResult add(Map<String, Object> params) {
                return AjaxResult.me().setSuccess(false).setMessage("托底处理！添加失败");
            }

            @Override
            public String get(String key) {
                return null;
            }

            @Override
            public AjaxResult del(String key) {
                return AjaxResult.me().setSuccess(false).setMessage("托底处理！添加失败");
            }
        };
    }
}
